/* TODO 使用STL实现List */

#ifndef VANTIDEL_CPP_OBJLIST_H
#define VANTIDEL_CPP_OBJLIST_H

#include "Class.h"
#include "vm.h"

class ObjList {
public:
    ObjHeader objHeader;
    ValueBuffer elements{};  //list中的元素

    ObjList(VM *vm, uint32_t elementNum);

    static ObjList *NewObjList(VM *vm, uint32_t elementNum);

    static void ShrinkList(VM* vm, ObjList* objList, uint32_t newCapacity);

    static Value RemoveElement(VM *vm, ObjList *objList, uint32_t index);

    static void InsertElement(VM *vm, ObjList *objList, uint32_t index, Value value);
};


#endif //VANTIDEL_CPP_OBJLIST_H
